﻿using System;
using System.Collections.Generic;
 
using System.Text;
using System.IO;

namespace GGSharp.Http
{
    public class TokenInfo : HttpStructureBase
    {
        private int _height;
        private string _id;
        private int _length;
        private string _path;
        private int _width;

        public int Height
        {
            get { return _height; }
            set { _height = value; }
        }

        public string ID
        {
            get { return _id; }
            set { _id = value; }
        }

        public string ImagePath
        {
            get { return _path + "?tokenid=" + _id; }
        }

        public int Length
        {
            get { return _length; }
            set { _length = value; }
        }

        public string Path
        {
            get { return _path; }
            set { _path = value; }
        }

        public int Width
        {
            get { return _width; }
            set { _width = value; }
        }

        public override void Read(StreamReader reader)
        {
            string[] dim = reader.ReadLine().Split(' ');

            Int32.TryParse(dim[0], out _width);
            Int32.TryParse(dim[1], out _height);
            Int32.TryParse(dim[2], out _length);

            _id = reader.ReadLine();
            _path = reader.ReadLine();

            this.State = RequestState.Ready;
        }
    }
}
